<?php

// Copyright 2019-2022 Hackware SpA <human@hackware.cl>
// This file is part of "Hackware Web Services Payment" and licensed under
// the terms of the GNU Affero General Public License version 3, or (at your
// option) a later version. You should have received a copy of this license
// along with the software. If not, see <https://www.gnu.org/licenses/>.

return [
    'class' => '\Hawese\Payment\Gateways\KhipuGateway',
    'countries' => ['CL'],
    'credentials' => [
        'receiverId' => env('KHIPU_RECEIVER_ID'),
        'secretKey' => env('KHIPU_SECRET_KEY'),
    ],
    'payment_methods' => [
        'purchase' => 'payment_method',
    ],
    'schemas' => [
        'purchase' => [
            'required' => [
                'subject',
                'currency',
                'amount',
                'payer_email',
                'payment_method',
            ],
            'standard_map' => [
                'subject' => 'subject',
                'email' => 'payer_email',
                'due_amount' => 'amount',
                'payment_method' => 'payment_method',
                'currency' => 'currency'
            ],
            'properties' => [
                'subject' => [
                    'title' => 'Descripción',
                    'type' => 'string',
                ],
                'currency' => [
                    'title' => 'Moneda',
                    'type' => 'string',
                    'enum' => ['CLP'],
                    'default' => 'CLP',
                    'readOnly' => true,
                ],
                'amount' => [
                    'title' => 'Monto',
                    'type' => 'number',
                    'multipleOf' => 1,
                ],
                'payer_email' => [
                    'title' => 'Email',
                    'type' => 'string',
                ],
                'payment_method' => [ // for internal use, not sent to Khipu
                    'title' => 'Medio de pago',
                    'type' => 'string',
                    'oneOf' => [
                        [
                            'const' => 'simplified_transfer',
                            'title' => 'Khipu',
                            'description' => (
                                'Transferencia bancaria por medio de app Khipu'
                            ),
                            'image' => env('APP_URL') .
                                '/img/payment_methods/khipu.svg',
                        ],
                        [
                            'const' => 'transfer',
                            'title' => 'Transferencia',
                            'description' => 'Transferencia bancaria',
                            'image' => env('APP_URL') .
                                '/img/payment_methods/khipu_transfer.svg',
                        ],
                    ],
                ],
            ],
        ],
    ],
];
